<template>
  <div class="dynamic_form_item">
      <a-form-item :name="props.question.key" :wrapperCol="{ span: 20 }">
        <template v-slot:label>
          <label for="">{{ props.question.label }}</label>
        </template>
        <Tinymce :value="tinymceHtml" :id="props.question.key" :initData="props.question.state.initData"></Tinymce>
      </a-form-item>
  </div>
</template>
<script setup lang="ts">
import { watch,onMounted, reactive} from "vue";
import { QuestionBase } from "../../../question-base";
import { Subscription } from 'rxjs';
import Tinymce from '@/components/public-template/Tinymce/Tinymce.component.vue';

//subject变量
let $subscribeSub: Subscription;

let tinymceHtml:any = reactive({value:''});
let props = defineProps<{ question: QuestionBase<any>,formData:any}>();
const emit = defineEmits([ "update:formData"]);
watch(()=>tinymceHtml.value, (val)=>{
    emit('update:formData', val);
    props.question.value = val;
},{ flush:'sync' });

onMounted(() => {
})

</script>


<style lang="less" scoped>
@import url('./input-tinymce.component.less');
</style>
